<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/global.jsp" %>

<%-- 填充content --%>
<layout:override name="content">
    <div class="navbar">
        <div class="navbar-inner">
            <a href="${ctxPath}/" class="brand"><span class="first">${options.site_name}</span></a>
        </div>
    </div>
    <div class="row-fluid">
        <div class="dialog">
            <div class="block">
                <p class="block-heading">安装</p>
                <div class="block-body">
                    <form action="${ctxPath}/admin/install" method="post">
                        <label>邮箱帐号：</label>
                        <input type="email" name="email" required="required" original-title="推荐使用网易或QQ邮箱！" class="span12"/>
                        <label>设置密码：</label>
                        <input type="password" name="pwd" required="required" original-title="请输入您的密码，6～24个字符！" class="span12"/>
                        <input type="submit" value="安装" class="btn btn-primary pull-right"/>
                        <div class="clearfix"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</layout:override>

<%-- 填充script --%>
<layout:override name="script">
    <script type="text/javascript">
        $(function(){
            $('form').submit(function(){
                var dialog = $.dialog();
                _post(this, dialog, function(data){
                    if(data.code === 0) {
                        dialog.content('安装成功！').lock().time(1000);
                        setTimeout(function(){
                            location.href = "${ctxPath}/sign_in";
                        }, 1000);
                    } else {
                        dialog.content('安装失败，请检查用户名和密码！').lock().time(2000);
                    }
                });
                return false;
            });
        })
    </script>
</layout:override>

<%@ include file="/commons/_layout_admin.jsp" %>